<template>
  <el-row class="panel-group" :gutter="40">
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class='card-panel' @click="handleSetLineChartData('newVisitis')">
        <div class="card-icon">
          <i class="iconfont icon-12"></i>
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">观点</div>
          <div class="card-panel-list">
            <i>总数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.viewpoint.sum" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当月数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.viewpoint.month" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当日数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.viewpoint.day" :duration="2600"></count-to>
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('messages')">
        <div class="card-icon">
          <i class="iconfont icon-6"></i>
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">直播</div>
         <div class="card-panel-list">
            <i>总数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.room.sum" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当月数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.room.month" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当日数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.room.day" :duration="2600"></count-to>
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('purchases')">
        <div class="card-icon">
          <i class="iconfont icon-13"></i>
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">问答</div>
          <div class="card-panel-list">
            <i>总数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.answer.sum" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当月数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.answer.month" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当日数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.answer.day" :duration="2600"></count-to>
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('shoppings')">
        <div class="card-icon">
          <i class="iconfont icon-9"></i>
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">计划</div>
         <div class="card-panel-list">
            <i>总数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.plan.sum" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当月数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.plan.month" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当日数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.plan.day" :duration="2600"></count-to>
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('shoppings')">
        <div class="card-icon">
          <i class="iconfont icon-6"></i>
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">访问量</div>
         <div class="card-panel-list">
            <i>总数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.views.sum" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当月数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.views.month" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当日数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.views.day" :duration="2600"></count-to>
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('shoppings')">
        <div class="card-icon">
          <i class="iconfont icon-14"></i>
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">注册量</div>
         <div class="card-panel-list">
            <i>总数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.register.sum" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当月数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.register.month" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当日数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.register.day" :duration="2600"></count-to>
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('shoppings')">
        <div class="card-icon">
          <i class="iconfont icon-ecurityCode"></i>
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">认证量</div>
          <div class="card-panel-list">
            <i>总数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.cert.sum" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当月数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.cert.month" :duration="2600"></count-to>
          </div>
          <div class="card-panel-list">
            <i>当日数量</i>
            <count-to class="card-panel-num" :startVal="0" :endVal="data.cert.day" :duration="2600"></count-to>
          </div>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
import CountTo from 'vue-count-to'

export default {
  props: {
    data: {}
  },
  components: {
    CountTo
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.panel-group {
  margin-top: 18px;
  .card-panel-col{
    margin-bottom: 32px;
  }
  .card-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);
    .card-icon {
      transition: all 0.3s ease;
      padding: 20px;
      .iconfont {
        font-size: 45px;
      }
    }
    &:hover {
      .card-icon{
        background: #f4f4f4;
      }
    }
    .icon-12 {
       color: #40c9c6;
    }
    .icon-13 {
      color: #36a3f7;
    }
    .icon-14 {
      color: #f4516c;
    }
    .icon-15 {
      color: #34bfa3
    }
    .card-panel-description {
      min-width: 160px;
      font-weight: bold;
      padding: 20px;
      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 5px;
      }
      .card-panel-list{
        padding: 3px 0;
        &:nth-child(2) {
          border-bottom: 1px #e4e4e4 solid;
        }
        &> i {
          color: rgba(0, 0, 0, 0.45);
          font-weight: normal;
          padding-right: 3px;
          font-style: normal;
        }
        .card-panel-num {
          font-size: 15px;
        }
      }
    }
  }
}
</style>
